#!/usr/bin/env python3

import os
from PySide6.QtCore import QLibraryInfo

#import Philatelist
#
#Philatelist.PRJ_PATH = os.path.abspath(os.path.dirname(__file__))
#base_path = os.path.join(os.path.dirname(__file__), "../Philatelist")
pyqt_path = QLibraryInfo.path(QLibraryInfo.BinariesPath)
lupdate_path = os.path.join(pyqt_path, 'pylupdate6')
src_path = os.path.abspath(os.path.dirname(__file__))
src_path = os.path.dirname(src_path)
src_path = os.path.join(src_path, "Philatelist")
src_files = []
for dirname, _, filenames in os.walk(src_path):
    for filename in filenames:
        file_title, file_extension = os.path.splitext(filename)
        if file_extension == '.py' and file_title not in ("resources"):
            src_files.append(os.path.join(dirname, filename))

dst_file = os.path.join(os.path.dirname(__file__), "i18n/lang_ru.ts")
os.system(
    ' '.join(
        [
            lupdate_path,
            '-no-obsolete',
            '-ts', dst_file,
            ' '.join(src_files),
        ]
    )
)
